package com.test.mvcservice.util;

import org.springframework.core.convert.converter.Converter;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by 20161021 on 2018/4/15.
 */
public class DateConverter implements Converter<String,Date> {

    public Date convert(String source){
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        try{
            return df.parse(source);
        }catch (ParseException e){
            e.printStackTrace();
        }
        return null;
    }
}
